<!DOCTYPE html>
<head>
<title>RMQ Console</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="../login/css/font-awesome.min.css" rel="stylesheet"
	type="text/css">
<link href="../login/css/bootstrap.min.css" rel="stylesheet"
	type="text/css">
<link href="../login/css/bootstrap-theme.min.css" rel="stylesheet"
	type="text/css">
<link href="../login/css/templatemo_style.css" rel="stylesheet"
	type="text/css">
<script th:src="@{/js/jquery.min.js}"
	src="../login/js/jquery-1.11.1.min.js"></script>
<script th:src="@{/js/bootstrap.min.js}"
	src="../login/js/bootstrap.min.js"></script>
<script type="text/javascript">
	$(function() {
		$("body").keydown(function() {
            if (event.keyCode == 13) {//keyCode=13是回车键
                $('#submit').click();
            }
        });
		$.post("/shiro/getRegionName", function(data) {
			$("#title").text(data.data);
		});
		$.post("/shiro/listRegionConsole", function(res) {
			var listConsole = JSON.parse(res.data);
			for ( var i in listConsole) {
				$('#listConsole').append(
						"<a href='"+listConsole[i].consoleIp+"'>"
								+listConsole[i].enviroCode+"_"+listConsole[i].regionName + "</a>");
				$('#listConsole').append("  ");
			}
		});
		$("#submit").click(function() {
			$.post("/shiro/login", $("#loginForm").serialize(), function(data) {
				if (data.status == 0) {
					window.location.href = "/index.html";
				} else if (data.status == 1) {
					$("#tick").text(data.errMsg).css("color", "red");
				}
			})
		});
	});
</script>
</head>
<body class="templatemo-bg-gray" >
	<div class="container">
		<div class="col-md-12">
			<h1 class="margin-bottom-15" id="title">RMQ控制台登录</h1>
			<form
				class="form-horizontal templatemo-container templatemo-login-form-1 margin-bottom-30"
				id="loginForm">
				<div class="form-group">
					<label class="col-sm-10 control-label"
						style="color: red; text-align: center" id="tick">&nbsp;</label>
				</div>
				<div class="form-group">
					<div class="col-xs-12">
						<div class="control-wrapper">
							<label for="username" class="control-label fa-label"><i
								class="fa fa-user fa-medium"></i></label> <input type="text"
								class="form-control" id="username" name="username"
								placeholder="Username">
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-12">
						<div class="control-wrapper">
							<label for="password" class="control-label fa-label"><i
								class="fa fa-lock fa-medium"></i></label> <input type="password"
								class="form-control" id="password" name="password"
								placeholder="Password">
						</div>
					</div>
				</div>
				<!-- <div class="form-group">
					<div class="col-md-12">
						<div class="checkbox control-wrapper">
							<label> <input type="checkbox"> Remember me
							</label>
						</div>
					</div>
				</div> -->
				<div class="form-group">
					<div class="col-md-12">
						<div class="control-wrapper">
							<!-- <input type="submit" value="Log in" class="btn btn-info"> -->
							<button type="button" id="submit" class="btn btn-default">登录</button>
						</div>
					</div>
				</div>
				<hr>
				控制台列表:
				<div class="form-group">
					<div class="col-md-12">
						<div class="control-wrapper" id="listConsole"></div>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
</html>